import { http } from '@/api';
import { PORT1 } from '@/api/config/port';
import { ResultData } from '@/api/interface/index';
import { EntityCreate, EntitySearch, RepActive } from '../interface/entity';
import qs from 'qs';

// 创建
export const Create = (params: EntityCreate) => {
  return http.post<ResultData>(PORT1 + `/admin/entity/create`, params);
};

// 更新
export const Update = (params: EntityCreate) => {
  return http.post<ResultData>(PORT1 + `/admin/entity/update`, params);
};

// 查询列表
export const Search = (params: EntitySearch) => {
  return http.post<any>(PORT1 + `/admin/entity/search`, params);
};

// 删除列表
export const Delete = (id: string) => {
  return http.get<any>(
    PORT1 + `/admin/entity/delete`,
    { id: id },
    { loading: true }
  );
};

// 禁用启用
export const Active = (params: RepActive) => {
  return http.post<any>(PORT1 + `/admin/entity/active`, params);
};

// 查询列表
export const entityGet = (params: any) => {
  return http.post<any>(PORT1 + `/admin/compliance/entitys`, params);
};
// otp导出列表
export const Export = (params: EntitySearch) => {
  return http.download(PORT1 + `/admin/entity/export`, params, {
    loading: true,
  });
};
